package com.test3;

import java.util.Enumeration;
import java.util.Vector;

public class VectorTest {
    public static void main(String[] args) {
        Vector vector = new Vector();
        //添加元素
        vector.add("a");
        vector.add("b");
        vector.add("c");
        System.out.println(vector);//[a, b, c]
        //删除元素
        vector.remove(0);
        System.out.println(vector);//[b, c]
        vector.remove("b");
        System.out.println(vector);//[c]
        //遍历
        //使用枚举器
        Enumeration en = vector.elements();
        while (en.hasMoreElements()){
            String o = (String) en.nextElement();
            System.out.println(o);
        }
        //判断
        System.out.println(vector.contains("c"));//true
        System.out.println(vector.isEmpty());//false
    }
}
